package com.soft.javase.ch02.test06;

/**
 * @author wangzhisen
 * @Desc TODO
 * @date 2025/4/18
 */
public class Test {

    public static void main(String[] args) {
        //商品
        Goods goods1 = new Goods("水杯" , 199.9 , 20 , "耐摔，好看");
        Goods goods2 = new Goods("显示器" , 222.2 , 10 , "屏幕大，4K超清");
        Goods goods3 = new Goods("零食" , 9.9 , 30 , "好吃");
        Goods goods4 = new Goods("手机" , 1999.9 , 5 , "好用");

        //用户
        User user1 = new User("张三" , "江苏无锡" , "123123123123");
        User user2 = new User("李四" , "安徽合肥" , "111222333444");

        //订单
        Order o1 = new Order("SY001" , user1 , new Goods[]{goods1,goods2});
        Order o2 = new Order("SY002" , user1 , new Goods[]{goods4});
        Order o3 = new Order("SY003" , user2 , new Goods[]{goods1,goods2,goods3});

        //张三的下单
        user1.setOrders(new Order[]{o1,o2});
        //李四的下单
        user2.setOrders(new Order[]{o3});

        /*System.out.println("------- 显示订单信息 --------");
        o1.showOrderDetail();
        o2.showOrderDetail();
        o3.showOrderDetail();*/

        System.out.println("------- 用户下单信息 --------");
        user1.xiadan();
        System.out.println("------- 用户下单信息 --------");
        user2.xiadan();

        //StackOverflowError  堆栈溢出错误
        //System.out.println("user1 = "+user1);
    }

}
